<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Freetype OpenGL: vertex-buffer.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="style.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="content"><!-- do not remove this div! -->

<div id="top"><!-- do not remove this div! -->

  
  <div id="titlearea">
    
    <div id="projectname">Freetype OpenGL</div>
    
    
    <div id="projectbrief">A high quality OpenGL text rendering engine for C</div>
    
  </div>
  

<!--

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Freetype OpenGL
   &#160;<span id="projectnumber">0.1</span>
   </div>
   <div id="projectbrief">A high quality OpenGL text rendering engine for C</div>
  </td>
  
  
  
   
  
 </tr>
 </tbody>
</table>
</div>
-->


<!-- Generated by Doxygen 1.8.0 -->
<script type="text/javascript" src="dynsections.js"></script>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">vertex-buffer.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="vertex-buffer_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* ============================================================================</span>
<a name="l00002"></a>00002 <span class="comment"> * Freetype GL - A C OpenGL Freetype engine</span>
<a name="l00003"></a>00003 <span class="comment"> * Platform:    Any</span>
<a name="l00004"></a>00004 <span class="comment"> * WWW:         http://code.google.com/p/freetype-gl/</span>
<a name="l00005"></a>00005 <span class="comment"> * ----------------------------------------------------------------------------</span>
<a name="l00006"></a>00006 <span class="comment"> * Copyright 2011,2012 Nicolas P. Rougier. All rights reserved.</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>
<a name="l00009"></a>00009 <span class="comment"> * modification, are permitted provided that the following conditions are met:</span>
<a name="l00010"></a>00010 <span class="comment"> *</span>
<a name="l00011"></a>00011 <span class="comment"> *  1. Redistributions of source code must retain the above copyright notice,</span>
<a name="l00012"></a>00012 <span class="comment"> *     this list of conditions and the following disclaimer.</span>
<a name="l00013"></a>00013 <span class="comment"> *</span>
<a name="l00014"></a>00014 <span class="comment"> *  2. Redistributions in binary form must reproduce the above copyright</span>
<a name="l00015"></a>00015 <span class="comment"> *     notice, this list of conditions and the following disclaimer in the</span>
<a name="l00016"></a>00016 <span class="comment"> *     documentation and/or other materials provided with the distribution.</span>
<a name="l00017"></a>00017 <span class="comment"> *</span>
<a name="l00018"></a>00018 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY NICOLAS P. ROUGIER &#39;&#39;AS IS&#39;&#39; AND ANY EXPRESS OR</span>
<a name="l00019"></a>00019 <span class="comment"> * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF</span>
<a name="l00020"></a>00020 <span class="comment"> * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO</span>
<a name="l00021"></a>00021 <span class="comment"> * EVENT SHALL NICOLAS P. ROUGIER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,</span>
<a name="l00022"></a>00022 <span class="comment"> * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES</span>
<a name="l00023"></a>00023 <span class="comment"> * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;</span>
<a name="l00024"></a>00024 <span class="comment"> * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</span>
<a name="l00025"></a>00025 <span class="comment"> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span>
<a name="l00026"></a>00026 <span class="comment"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF</span>
<a name="l00027"></a>00027 <span class="comment"> * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
<a name="l00028"></a>00028 <span class="comment"> *</span>
<a name="l00029"></a>00029 <span class="comment"> * The views and conclusions contained in the software and documentation are</span>
<a name="l00030"></a>00030 <span class="comment"> * those of the authors and should not be interpreted as representing official</span>
<a name="l00031"></a>00031 <span class="comment"> * policies, either expressed or implied, of Nicolas P. Rougier.</span>
<a name="l00032"></a>00032 <span class="comment"> * ============================================================================</span>
<a name="l00033"></a>00033 <span class="comment"> */</span>
<a name="l00034"></a>00034 <span class="preprocessor">#ifndef __VERTEX_BUFFER_H__</span>
<a name="l00035"></a>00035 <span class="preprocessor"></span><span class="preprocessor">#define __VERTEX_BUFFER_H__</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span>
<a name="l00037"></a>00037 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00039"></a>00039 <span class="preprocessor">#endif</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00041"></a>00041 <span class="preprocessor">#include &quot;opengl.h&quot;</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include &quot;<a class="code" href="vector_8h.html">vector.h</a>&quot;</span>
<a name="l00043"></a>00043 <span class="preprocessor">#include &quot;<a class="code" href="vertex-attribute_8h.html">vertex-attribute.h</a>&quot;</span>
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 
<a name="l00046"></a>00046 
<a name="l00061"></a><a class="code" href="structvertex__buffer__t.html">00061</a> <span class="keyword">typedef</span> <span class="keyword">struct</span>
<a name="l00062"></a>00062 {
<a name="l00064"></a><a class="code" href="structvertex__buffer__t.html#abf68b059413abc5d898c10904521c2c9">00064</a>     <span class="keywordtype">char</span> * <a class="code" href="structvertex__buffer__t.html#abf68b059413abc5d898c10904521c2c9" title="Format of the vertex buffer.">format</a>;
<a name="l00065"></a>00065 
<a name="l00067"></a><a class="code" href="structvertex__buffer__t.html#a54efd077fb2990b3679d060baaa021ec">00067</a>     <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> * <a class="code" href="structvertex__buffer__t.html#a54efd077fb2990b3679d060baaa021ec" title="Vector of vertices.">vertices</a>;
<a name="l00068"></a>00068 
<a name="l00070"></a><a class="code" href="structvertex__buffer__t.html#a3019a0907b688342301d74731da8c2c5">00070</a>     GLuint <a class="code" href="structvertex__buffer__t.html#a3019a0907b688342301d74731da8c2c5" title="GL identity of the vertices buffer.">vertices_id</a>;
<a name="l00071"></a>00071 
<a name="l00073"></a><a class="code" href="structvertex__buffer__t.html#a95e22c6a05d97a057fc71bd38a1d2175">00073</a>     <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> * <a class="code" href="structvertex__buffer__t.html#a95e22c6a05d97a057fc71bd38a1d2175" title="Vector of indices.">indices</a>;
<a name="l00074"></a>00074 
<a name="l00076"></a><a class="code" href="structvertex__buffer__t.html#a0f05a827428451421a7a2c99bec3ae93">00076</a>     GLuint <a class="code" href="structvertex__buffer__t.html#a0f05a827428451421a7a2c99bec3ae93" title="GL identity of the indices buffer.">indices_id</a>;
<a name="l00077"></a>00077 
<a name="l00079"></a><a class="code" href="structvertex__buffer__t.html#a91ae728d664e87cee290e1bdd2f98b6d">00079</a>     GLenum <a class="code" href="structvertex__buffer__t.html#a91ae728d664e87cee290e1bdd2f98b6d" title="GL primitives to render.">mode</a>;
<a name="l00080"></a>00080 
<a name="l00082"></a><a class="code" href="structvertex__buffer__t.html#ae19c17cfbb59a81cbfa7d5af2c336e7b">00082</a>     <span class="keywordtype">char</span> <a class="code" href="structvertex__buffer__t.html#ae19c17cfbb59a81cbfa7d5af2c336e7b" title="Whether the vertex buffer needs to be uploaded to GPU memory.">dirty</a>;
<a name="l00083"></a>00083 
<a name="l00085"></a><a class="code" href="structvertex__buffer__t.html#aba48b4d0cd079739d4a89d3c3f29a187">00085</a>     <a class="code" href="structvector__t.html" title="Generic vector structure.">vector_t</a> * <a class="code" href="structvertex__buffer__t.html#aba48b4d0cd079739d4a89d3c3f29a187" title="Individual items.">items</a>;
<a name="l00086"></a>00086 
<a name="l00088"></a><a class="code" href="structvertex__buffer__t.html#ab54b50b1609cf48995b5284bfa9eea6f">00088</a>     <a class="code" href="structvertex__attribute__t.html" title="Generic vertex attribute.">vertex_attribute_t</a> *attributes[<a class="code" href="group__vertex-attribut.html#ga9555c2d7b2932a0f83629c11fd863c7a" title="Maximum number of attributes per vertex.">MAX_VERTEX_ATTRIBUTE</a>];
<a name="l00089"></a>00089 } <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a>;
<a name="l00090"></a>00090 
<a name="l00091"></a>00091 
<a name="l00098"></a>00098   <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *
<a name="l00099"></a>00099   <a class="code" href="group__vertex-buffer.html#ga309c1129a1028f251fe6e6c3c1534a42" title="Creates an empty vertex buffer.">vertex_buffer_new</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> *format );
<a name="l00100"></a>00100 
<a name="l00101"></a>00101 
<a name="l00107"></a>00107   <span class="keywordtype">void</span>
<a name="l00108"></a>00108   <a class="code" href="group__vertex-buffer.html#gae597565df08dfc7be10350e623212713" title="Deletes vertex buffer and releases GPU memory.">vertex_buffer_delete</a>( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> * <span class="keyword">self</span> );
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 
<a name="l00117"></a>00117   <span class="keywordtype">size_t</span>
<a name="l00118"></a>00118   <a class="code" href="group__vertex-buffer.html#ga98cefebba15a1a170952b85e450d85ff" title="Returns the number of items in the vertex buffer.">vertex_buffer_size</a>( <span class="keyword">const</span> <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *<span class="keyword">self</span> );
<a name="l00119"></a>00119 
<a name="l00120"></a>00120 
<a name="l00127"></a>00127   <span class="keyword">const</span> <span class="keywordtype">char</span> *
<a name="l00128"></a>00128   <a class="code" href="group__vertex-buffer.html#gabe9bdf532963705ffa166c3017f95006" title="Returns vertex format.">vertex_buffer_format</a>( <span class="keyword">const</span> <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *<span class="keyword">self</span> );
<a name="l00129"></a>00129 
<a name="l00130"></a>00130 
<a name="l00136"></a>00136   <span class="keywordtype">void</span>
<a name="l00137"></a>00137   <a class="code" href="group__vertex-buffer.html#gac1b6b528b73233638705a42a9d2c54e9" title="Print information about a vertex buffer.">vertex_buffer_print</a>( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> * <span class="keyword">self</span> );
<a name="l00138"></a>00138 
<a name="l00139"></a>00139 
<a name="l00147"></a>00147   <span class="keywordtype">void</span>
<a name="l00148"></a>00148   <a class="code" href="group__vertex-buffer.html#ga390b4831ad3ab7657df7e6fb8edde9e9" title="Prepare vertex buffer for render.">vertex_buffer_render_setup</a> ( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *<span class="keyword">self</span>,
<a name="l00149"></a>00149                                GLenum mode, <span class="keyword">const</span> <span class="keywordtype">char</span> *what );
<a name="l00150"></a>00150 
<a name="l00151"></a>00151 
<a name="l00157"></a>00157   <span class="keywordtype">void</span>
<a name="l00158"></a>00158   <a class="code" href="group__vertex-buffer.html#ga19e2403a6f104a4cfcf49122f4f40794" title="Finish rendering by setting back modified states.">vertex_buffer_render_finish</a> ( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *<span class="keyword">self</span> );
<a name="l00159"></a>00159 
<a name="l00160"></a>00160 
<a name="l00168"></a>00168   <span class="keywordtype">void</span>
<a name="l00169"></a>00169   <a class="code" href="group__vertex-buffer.html#ga48df5bafd9315aabfb7f14bedb778c16" title="Render vertex buffer.">vertex_buffer_render</a> ( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *<span class="keyword">self</span>,
<a name="l00170"></a>00170                          GLenum mode, <span class="keyword">const</span> <span class="keywordtype">char</span> *what );
<a name="l00171"></a>00171 
<a name="l00172"></a>00172 
<a name="l00179"></a>00179   <span class="keywordtype">void</span>
<a name="l00180"></a>00180   <a class="code" href="group__vertex-buffer.html#ga21efec3953697246c6c50a619f508225" title="Render a specified item from the vertex buffer.">vertex_buffer_render_item</a> ( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *<span class="keyword">self</span>,
<a name="l00181"></a>00181                               <span class="keywordtype">size_t</span> index );
<a name="l00182"></a>00182 
<a name="l00183"></a>00183 
<a name="l00189"></a>00189   <span class="keywordtype">void</span>
<a name="l00190"></a>00190   <a class="code" href="group__vertex-buffer.html#gae7bdc281640a4be5a60afb7d3f16a2eb" title="Upload buffer to GPU memory.">vertex_buffer_upload</a>( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *<span class="keyword">self</span> );
<a name="l00191"></a>00191 
<a name="l00192"></a>00192 
<a name="l00198"></a>00198   <span class="keywordtype">void</span>
<a name="l00199"></a>00199   <a class="code" href="group__vertex-buffer.html#ga5a1c907e3e66b12be0c142e6d03acdaf" title="Clear all items.">vertex_buffer_clear</a>( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *<span class="keyword">self</span> );
<a name="l00200"></a>00200 
<a name="l00201"></a>00201 
<a name="l00211"></a>00211   <span class="keywordtype">void</span>
<a name="l00212"></a>00212   vertex_buffer_push_back_indices ( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *<span class="keyword">self</span>,
<a name="l00213"></a>00213                                     GLuint * indices,
<a name="l00214"></a>00214                                     <span class="keywordtype">size_t</span> icount );
<a name="l00215"></a>00215 
<a name="l00216"></a>00216 
<a name="l00228"></a>00228   <span class="keywordtype">void</span>
<a name="l00229"></a>00229   vertex_buffer_push_back_vertices ( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *<span class="keyword">self</span>,
<a name="l00230"></a>00230                                      <span class="keywordtype">void</span> * vertices,
<a name="l00231"></a>00231                                      <span class="keywordtype">size_t</span> vcount );
<a name="l00232"></a>00232 
<a name="l00233"></a>00233 
<a name="l00244"></a>00244   <span class="keywordtype">void</span>
<a name="l00245"></a>00245   vertex_buffer_insert_indices ( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *<span class="keyword">self</span>,
<a name="l00246"></a>00246                                  <span class="keywordtype">size_t</span> index,
<a name="l00247"></a>00247                                  GLuint *indices,
<a name="l00248"></a>00248                                  <span class="keywordtype">size_t</span> icount );
<a name="l00249"></a>00249 
<a name="l00250"></a>00250 
<a name="l00261"></a>00261   <span class="keywordtype">void</span>
<a name="l00262"></a>00262   vertex_buffer_insert_vertices ( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *<span class="keyword">self</span>,
<a name="l00263"></a>00263                                   <span class="keywordtype">size_t</span> index,
<a name="l00264"></a>00264                                   <span class="keywordtype">void</span> *vertices,
<a name="l00265"></a>00265                                   <span class="keywordtype">size_t</span> vcount );
<a name="l00266"></a>00266 
<a name="l00276"></a>00276   <span class="keywordtype">void</span>
<a name="l00277"></a>00277   vertex_buffer_erase_indices ( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *<span class="keyword">self</span>,
<a name="l00278"></a>00278                                 <span class="keywordtype">size_t</span> first,
<a name="l00279"></a>00279                                 <span class="keywordtype">size_t</span> last );
<a name="l00280"></a>00280 
<a name="l00290"></a>00290   <span class="keywordtype">void</span>
<a name="l00291"></a>00291   vertex_buffer_erase_vertices ( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> *<span class="keyword">self</span>,
<a name="l00292"></a>00292                                  <span class="keywordtype">size_t</span> first,
<a name="l00293"></a>00293                                  <span class="keywordtype">size_t</span> last );
<a name="l00294"></a>00294 
<a name="l00295"></a>00295 
<a name="l00305"></a>00305   <span class="keywordtype">size_t</span>
<a name="l00306"></a>00306   <a class="code" href="group__vertex-buffer.html#ga6cefde8ec247bcf71ff62409b2aa056a" title="Append a new item to the collection.">vertex_buffer_push_back</a>( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> * <span class="keyword">self</span>,
<a name="l00307"></a>00307                            <span class="keywordtype">void</span> * vertices, <span class="keywordtype">size_t</span> vcount,  
<a name="l00308"></a>00308                            GLuint * indices, <span class="keywordtype">size_t</span> icount );
<a name="l00309"></a>00309 
<a name="l00310"></a>00310 
<a name="l00321"></a>00321   <span class="keywordtype">size_t</span>
<a name="l00322"></a>00322   <a class="code" href="group__vertex-buffer.html#gac2c777252c5dade93f26c56fc3427074" title="Insert a new item into the vertex buffer.">vertex_buffer_insert</a>( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> * <span class="keyword">self</span>,
<a name="l00323"></a>00323                         <span class="keywordtype">size_t</span> index,
<a name="l00324"></a>00324                         <span class="keywordtype">void</span> * vertices, <span class="keywordtype">size_t</span> vcount,  
<a name="l00325"></a>00325                         GLuint * indices, <span class="keywordtype">size_t</span> icount );
<a name="l00326"></a>00326 
<a name="l00333"></a>00333   <span class="keywordtype">void</span>
<a name="l00334"></a>00334   <a class="code" href="group__vertex-buffer.html#gaeaf9b4f1c666eba0363344f131e8880e" title="Erase an item from the vertex buffer.">vertex_buffer_erase</a>( <a class="code" href="structvertex__buffer__t.html" title="Generic vertex buffer.">vertex_buffer_t</a> * <span class="keyword">self</span>,
<a name="l00335"></a>00335                        <span class="keywordtype">size_t</span> index );
<a name="l00336"></a>00336 
<a name="l00339"></a>00339 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00340"></a>00340 <span class="preprocessor"></span>}
<a name="l00341"></a>00341 <span class="preprocessor">#endif</span>
<a name="l00342"></a>00342 <span class="preprocessor"></span>
<a name="l00343"></a>00343 <span class="preprocessor">#endif </span><span class="comment">/* __VERTEX_BUFFER_H__ */</span>
</pre></div></div><!-- contents -->
</div>
</body>
</html>
